﻿using UnityEditor;
using UnityEngine;

public static class NGUIExpandTools
{
    [CustomEditor(typeof(UIPanel))]
    public class NGUIPanelExpand : UIPanelInspector
    {
        protected override void DrawFinalProperties()
        {
            base.DrawFinalProperties();
            UIPanel panel = target as UIPanel;
            ExpandToolsMenu.CreateWindow(panel.gameObject);

            if (GUILayout.Button("FindWidget"))
            {
                FindWidget.CreateWindow(panel);
            }
        }
    }

    [CustomEditor(typeof(UIWidget))]
    public class NGUIWidgetExpand : UIWidgetInspector
    {
        protected override void DrawFinalProperties()
        {
            base.DrawFinalProperties();
            UIWidget widget = target as UIWidget;
            ExpandToolsMenu.CreateWindow(widget.gameObject);
        }
    }

    [CustomEditor(typeof(UIRect))]
    public class NGUIRectExpand : UIRectEditor
    {
        protected override void DrawFinalProperties()
        {
            base.DrawFinalProperties();
            UIRect rect = target as UIRect;
            ExpandToolsMenu.CreateWindow(rect.gameObject);
        }
    }
}